package com.myway.components.payment.yeepay.epos;

import java.util.Map;

import com.myway.components.payment.yeepay.interFace.YeepayInterFace;

/**
 * 类名称：Epos <br/>
 * 类描述：信用卡消费分账接口 <br/>
 * 创建时间：2015年12月16日 下午5:04:14 <br/>
 * @author 张涛
 * @version V1.0
 */
@SuppressWarnings("rawtypes")
public class Epos {

	/**
	 * 名称：getEposRequestBackMap <br/>
	 * 描述：发起支付请求 <br/> 
	 * @param parameterMap
	 * @param merId
	 * @return */
	public static Map getEposRequestBackMap(Map parameterMap,String merId,String keyValue,String eposePayUrl) {
		Map fixParameter = Info.getEposReqFixParameter(merId);
		String[] hmacOrder = Info.getEposReqHmacOrder();
		String[] backHmacOrder = Info.getEposReqBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(parameterMap, keyValue, eposePayUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}
	
	public static void main(String[] args) {
		eposPay();
	}
	
	
	
	
	@SuppressWarnings("unchecked")
	public static void eposPay(){
		String merId = "10001126856";
		String keyValue="69cl522AV6q613Ii4W6u8K6XuW8vM1N6bFgyv769220IuYe9u37N4y7rI4Pl";
		String eposePayUrl  = "https://www.yeepay.com/app-airsupport/AirSupportCommand.action";
		Map parameterMap = Info.getEposReqFixParameter(merId);
		
		//bak	20151221171247001,20151221171247002,20151221171247003
				
		//订单
		parameterMap.put("p2_Order", "20151221171247004");		
		//金额
		parameterMap.put("p3_Amt", "0.1");	
		//名称
		parameterMap.put("p5_Pid", "20151221171247002");	
		//商品详情
		parameterMap.put("p6_Pdetail", "");
		//回调地址
		parameterMap.put("p8_Url", "localhost:8080/commonService");
		//证件类型
		parameterMap.put("pa_CredType", "IDCARD");
		//证件号码
		parameterMap.put("pb_CredCode", "341124198009190725");
		//手机号
		parameterMap.put("pe_BuyerTel", "13811907888");
		//姓名
		parameterMap.put("pf_BuyerName", "汤影");
		//卡号
		parameterMap.put("pt_ActId", "4512900381973100");
		//有效期年
		parameterMap.put("pa2_ExpireYear", "2019");
		//有效期月
		parameterMap.put("pa3_ExpireMonth", "09");
		//CVV
		parameterMap.put("pa4_CVV", "512");
		//开户行
		parameterMap.put("pa5_BankBranch", "china");
		//详情
		parameterMap.put("pa_Details", "Default:Airfenzhang@air-union.com:0.1");
		//自动分账
		parameterMap.put("pc_AutoSplit", "1");
		//易宝账户
		parameterMap.put("py_IsYeePayName", "1");
		//终端号
		parameterMap.put("prisk_TerminalCode", "");
		//风控拓展参数
		parameterMap.put("prisk_Param", "");
		Map eposRequestBackMap = getEposRequestBackMap(parameterMap, merId, keyValue, eposePayUrl);
		System.out.println(eposRequestBackMap);
	}
	
	
	
	
	
	
	
	
	
	
	/**
	 * 名称：getEposQueryBackMap <br/>
	 * 描述：发起查询请求 <br/>
	 * @param parameterMap
	 * @param merId
	 * @param keyValue
	 * @param eposePayUrl
	 * @return
	 */
	public static Map getEposQueryBackMap(Map parameterMap,String merId,String keyValue,String eposeQueryUrl) {
		Map fixParameter = Info.getEposQueryFixParameter(merId);
		String[] hmacOrder = Info.getEposQueryHmacOrder();
		String[] backHmacOrder = Info.getEposQueryBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(parameterMap, keyValue, eposeQueryUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}

	/**
	 * 名称：getEposRefundBackMap <br/>
	 * 描述：发起退款请求业务处理 <br/>
	 * @param parameterMap
	 * @return
	 */
	public static Map getEposRefundBackMap(Map parameterMap,String merId,String keyValue,String eposeRefundUrl) {
		Map fixParameter = Info.getEposRefundFixParameter(merId);
		String[] hmacOrder = Info.getEposRefundHmacOrder();
		String[] backHmacOrder = Info.getEposRefundBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(parameterMap, keyValue, eposeRefundUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}

	/**
	 * 名称：getEposCallbackMap <br/>
	 * 描述：接收支付返回业务处理 <br/>
	 * @param parameterMap
	 * @return
	 */
	public static Map getEposCallbackMap(Map parameterMap,String keyValue) {
		String[] callbackHmacOrder = Info.getEposCallbackHmacOrder();
		return YeepayInterFace.getCallbackMap(parameterMap, keyValue,
				callbackHmacOrder);
	}

	/**
	 * 名称：getEposVerifySaleRequestBackMap <br/>
	 * 描述：信用卡验证码消费接口 <br/>
	 * @param parameterMap
	 * @return
	 */
	public static Map getEposVerifySaleRequestBackMap(Map parameterMap,String merId,String keyValue,String veriftSaleUrl) {
		Map fixParameter = Info.getEposVerifySaleReqFixParameter(merId);
		String[] hmacOrder = Info.getEposVerifySaleReqHmacOrder();
		String[] backHmacOrder = Info.getEposVerifySaleReqBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(parameterMap, keyValue, veriftSaleUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}

	/**
	 * 名称：getEposVerifyCodeReceiveRequestBackMap <br/>
	 * 描述：接受验证码获取业务处理 <br/>
	 * @param parameterMap
	 * @return
	 */
	public static Map getEposVerifyCodeReceiveRequestBackMap(Map parameterMap,String merId,String keyValue,String verifyCodeReceiveUrl) {
		Map fixParameter = Info.getEposVerifyCodeReceiveReqFixParameter(merId);
		String[] hmacOrder = Info.getEposVerifyCodeReceiveReqHmacOrder();
		String[] backHmacOrder = Info.getEposVerifyCodeReceiveReqBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(parameterMap, keyValue, verifyCodeReceiveUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}
	
	
	
	
	
	
	
	/**
	 * 名称：getEposRequestBackMap <br/>
	 * 描述：页面调试支付 <br/>
	 * @param request
	 * @param merId
	 * @param keyValue
	 * @param eposPayUrl
	 * @return
	public static Map getEposRequestBackMap(HttpServletRequest request,String merId,String keyValue,String eposPayUrl) {
		Map fixParameter = Info.getEposReqFixParameter(merId);
		String[] hmacOrder = Info.getEposReqHmacOrder();
		String[] backHmacOrder = Info.getEposReqBackHmacOrder();
		Map requestBackMap = YeepayInterFace.getRequestBackMap(request, fixParameter, hmacOrder, backHmacOrder, eposPayUrl, keyValue);
		return requestBackMap;
	}*/

	/**
	 * 名称：getEposQueryBackMap <br/>
	 * 描述：页面调试查询 <br/>
	 * @param request
	 * @param merId
	 * @param keyValue
	 * @param eposQueryUrl
	 * @return
	public static Map getEposQueryBackMap(HttpServletRequest request,String merId,String keyValue,String eposQueryUrl) {
		Map fixParameter = Info.getEposQueryFixParameter(merId);
		String[] hmacOrder = Info.getEposQueryHmacOrder();
		String[] backHmacOrder = Info.getEposQueryBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(request, keyValue, eposQueryUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}*/
	
	/**
	 * 名称：getEposRefundBackMap <br/>
	 * 描述：页面退款调试 <br/>
	 * @param request
	 * @param merId
	 * @param keyValue
	 * @param eposeRefundUrl
	 * @return
	public static Map getEposRefundBackMap(HttpServletRequest request,String merId,String keyValue,String eposeRefundUrl) {
		Map fixParameter = Info.getEposRefundFixParameter(merId);
		String[] hmacOrder = Info.getEposRefundHmacOrder();
		String[] backHmacOrder = Info.getEposRefundBackHmacOrder();
		return YeepayInterFace.getRequestBackMap(request, keyValue, eposeRefundUrl,
				fixParameter, hmacOrder, backHmacOrder);
	}*/
	
	/**
	 * 名称：getEposCallbackMap <br/>
	 * 描述：页面调试接收支付返回业务处理 <br/>
	 * @param request
	 * @return
	public static Map getEposCallbackMap(HttpServletRequest request,String keyValue) {
		String[] callbackHmacOrder = Info.getEposCallbackHmacOrder();
		return YeepayInterFace.getCallbackMap(request, callbackHmacOrder,
				keyValue);
	}*/
	
	
	
}
